//
//  CommonObjInfo.m
//  RSW.IOS
//
//  Created by zhaiqiuqiu on 2017/9/3.
//  Copyright © 2017年 com.xtion.crm. All rights reserved.
//

#import "CommonObjInfo.h"

@implementation CommonObjInfo

static XMSQueueDictionary *s_jsonPair;

+ (void)initialize
{
    if(s_jsonPair == nil)
    {
        XMSQueueDictionary *qd = [[XMSQueueDictionary alloc] initWithStoreClass:[CObjTransformPropertyPair class]];
        
        [qd addKey:@"expandfields" value:@"expandfields"];
        
        s_jsonPair = [CTransformHTTPRESTObj registerJSONObjectClass:[CommonObjInfo class] JSONKeyPair:qd];
    }
}

+ (XMSQueueDictionary *)JSONObjectProperty:(NSArray *)JSONKeys
{
    return [CTransformHTTPRESTObj JSONObjectMap:s_jsonPair propertyWithJSONKey:JSONKeys];
}

- (id)copyWithZone:(NSZone *)zone
{
    CommonObjInfo *ci = [[self class] allocWithZone:zone];
    ci.expandfields = [self.expandfields mutableCopy];
    
    return ci;
}

-(NSMutableDictionary*)expandfields
{
    if(_expandfields == nil || [_expandfields isKindOfClass:[NSNull class]])
        _expandfields = [NSMutableDictionary new];
    
    return _expandfields;
}

-(NSMutableArray*)attachmentPaths
{
    if(_attachmentPaths == nil || [_attachmentPaths isKindOfClass:[NSNull class]])
        _attachmentPaths = [NSMutableArray new];
    
    return _attachmentPaths;
}

+(CommonObjInfo*)emptyCommonObjInfo
{
    CommonObjInfo *ci = [CommonObjInfo new];
    ci.expandfields = [NSMutableDictionary new];
    
    return ci;
}

@end
